//https://www.nowcoder.com/practice/e8a1b01a2df14cb2b228b30ee6a92163?tpId=13&&tqId=11181&rp=1&ru=/activity/oj&qru=/ta/coding-interviews/question-ranking
//数组中出现次数超过一半的数字

int MoreThanHalfNum_Solution(vector<int>& numbers) {
        // write code here
        int ret = -1;
        int count = 0;
        for(size_t i = 0; i < numbers.size(); i++)
        {
            if(count == 0)
            {
                ret = numbers[i];
                count++;
            }
            else 
            {
                if(ret == numbers[i])
                    count++;
                else
                    count--;
            }
        }


        return ret;
    }